< previous page page_294 next page >

Page 294
You can easily create your own snowflake definition files. Start by defining the initiator. Any shape will work, though regular polygons tend to produce some of the best pictures because they are symmetrical.
Give each segment in your generator the same length. This is easiest if you make the edges in the generator fall along the edges of triangles or squares in a regular lattice. Then the value of DistFactor is the ratio of the length of these segments to the distance from the first to the last point in the generator. Usually, a little geometry and trigonometry will help you calculate this ratio.
The generator shown in Figure 10.12, for example, lies in a lattice of equilateral triangles. If the side length of an equilateral triangle is S, its height is (S/2) * Sqr(3). Then this generator is 2 * S wide and 2 * (S/2) * Sqr(3) = S * Sqr(3) tall. That means the distance between the first and last points in the generator is Sqr((2 * S)2 + (S * Sqr(3))2) = Sqr(4 * S2 + S2 * 3) = S * Sqr(4 + 3) = S * Sqr(7). The ratio of the side length S to this distance is S/(S * Sqr(7)) = 1/Sqr(7), or roughly 0.3779645. That is the value DistFactor should have for this generator.
The last thing you need to do is to compute the generator's turn angles. If you lay your generator out on a triangular or square grid, most of the angles will be multiples of 60 or 90 degrees, respectively. You can make use of geometry and trigonometry again to determine the first angle.
In Figure 10.12, the angle between the first generator segment and the X axis is 60 degrees. The generator is 2 * S units wide and 2 * (S/2) * Sqr(3) = S * Sqr(3) units tall. Then the angle between the line connecting the first and last points and the X axis has tangent (S * Sqr(3))/(2 * S) = Sqr(3)/2. The first angle in the generator tells how much you need to turn to move from the path between the first and last generator points to the path toward the second generator point. In this case, that angle is the difference between the angles 60 degrees and arctangent(Sqr(3)/2). That difference 60 arctangent(Sqr(3)/2) is about 19.1 degrees.
The top pictures in Figure 10.14 show the initiator and a three-segment generator for a von Koch snowflake. The initiator is a square, and the points in the generator fall on the points of a square lattice. The bottom three pictures show the depth one, two, and three von Koch snowflakes produced by this initiator and generator.
If you create a snowflake using certain generators, pieces of the snowflake will overlap with others. This can produce a whole new kind of snowflake. The top of Figure 10.15 shows a hexagonal initiator and a seven-segment generator on a triangular lattice. The bottom pictures show the corresponding level one, two, and three overlapping snowflakes.
Once you have built up a collection of initiators and generators, you can mix and match them to produce new snowflakes. For example, you can use a hexagon instead of a square as an initiator with a three-segment rectangular generator. Figure 10.16 shows this initiator and generator, together with level one, two, and three snowflakes.

 
< previous page page_294 next page >